const express = require('express')
const path = require('path')
const engine = require('ejs-mate')
const appConfig = require('./config/app')
const webRouter = require('./routers/web')

const staticDir = path.join(__dirname, 'public')
const assets = {}

const app = express()

app.engine('html', engine)

app.set('views', path.join(__dirname, '/views'))
app.set('view engine', 'html')

// static files
app.use('/public', express.static(staticDir))

// router
app.use('/', webRouter)

app.listen(appConfig.port, function () {
  console.log(`server running on ${appConfig.port}`)
})
